<template>
  <router-link :to="href" class="book-list-item">
    <img v-lazy="$store.state.imgPath+img">
    <h3><slot name="book"></slot></h3>
    <p><slot name="author"></slot></p>
    <p><slot name="desc"></slot></p>
    <p class="tag">
      <my-tag v-for="(item,index) in tag" :key="index" CPNcolor="#ff976a">{{item}}</my-tag>
    </p>
  </router-link>
</template>

<script>
import MyTag from '@/components/MyTag.vue'
export default {
  components:{
    MyTag
  },
  props:{
    tag:Array,
    img:String,
    href:String,
  },
}
</script>

<style>
.book-list-item img{
  float: left;
  width: 82px;
  height: 115px;
  margin-right: 15px;
  border-radius: 4px;
  box-shadow: 2px 1px 5px 0px rgba(0,0,0,.2);
}
.book-list-item h3{
  font-weight: normal;
  font-size: 17px;
  color: #222;
  height: 20px;
  line-height: 20px;
  overflow: hidden;
  margin-bottom: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-list-item p{
  font-size: 12px;
  color: #999;
}
.book-list-item p:nth-of-type(1) {
  line-height: 16px;
  height: 16px;
  margin-bottom: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.book-list-item p:nth-of-type(2) {
  line-height: 18px;
  height: 36px;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-list-item p.tag {
  position: absolute;
  left: 97px;
  bottom: 20px;
  white-space: nowrap;
}

</style>